package com.tedu.ajax.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/10/13
 */

@RestController
public class JqueryController {


    @PostMapping("/doPost")
    public String doPost(@RequestBody @RequestParam Map<String,Object> map, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(map);
        return "post ok";
    }

    @GetMapping("/doGet")
    public Map<String,Object> doGet(HttpServletRequest request){
        System.out.println(request.getMethod());
        Map<String,Object> map = new HashMap<>();
        map.put("code",1);
        return map;
    }


    @RequestMapping("/doajax")
    public String doajax(String msg, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(msg);
        return msg.toUpperCase();
    }
}
